import web
import os
from web.contrib.template import render_mako
import sqlite3
urls=('/','hello','/add','goo',
      '/post','post',
)
application=web.application(urls,globals()).wsgifunc()
render=render_mako(directories='/var/www/hello-web/template',
                   input_encoding='utf-8',
                   output_encoding='utf-8',)
def notfound():
    return web.notfound(render.notfound())
application.notfound=notfound
class goo:
    def GET(self):
        return render.post()          
class post:
    def POST(self):
        date=web.input()
        con=sqlite3.connect('/var/www/hello-web/db/tests.db')
        str2="insert into artile(title,time,body)values('"+date.title+"','"+date.time+"','"+str(date.body)+"')"
        con.execute(str2)
        con.commit()
        con.close()
        return render.artile(title=date.title,time=date.time,body=date.body)
class hello:
    def GET(self):
        return "hello,are you ok!"
